import { defineStore } from "pinia";

export enum Size {
	default = "default",
	small = "small",
	large = "large",
}
const useSettingStore = defineStore("setting", {
	state: () => ({
		refresh: false,
		fold: false,
		size: Size.default,
	}),
	actions: {
		setSize(size: Size) {
			this.size = size;
		},
	},
	// 持久化配置
	persist: {
		key: "setting", // 存储到 localStorage 的 key
		storage: localStorage, // 存储方式
		pick: ["size"], // 需要持久化的状态字段
	},
});

export { useSettingStore };
